﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace TARLib
{
    public static class Settings
    {
        public static string GetServerProdottiImagePath()
        {
            string retValue = null;

            SqlConnection conn = new SqlConnection(Database.GetDBConnectionString());
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = conn;
            cmd.CommandText = "[Generale].[SP_GetSettings]";
            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            SqlDataReader dr = null;
            try
            {
                conn.Open();
                dr = cmd.ExecuteReader();

                if (dr.Read())
                {
                    retValue = dr["ServerProdottiImagePath"].ToString();
                }
                else
                {
                    // Setting non trovato
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                    dr.Dispose();
                }
                cmd.Dispose();
                conn.Close();
                conn.Dispose();
            }

            return retValue;
        }
    }
}
